package com.a9_lin.www.testormlite.bean;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

import java.util.Collection;

/**
 * 查看该账户绑定关系接口返回的实体类
 * 里边包含了
 * 外层的  DSOUT 这个Ds里边还包含了一个DsInner 代表的是绑定的设备的列表
 * 每个设备的详细信息 Userinfo
 * 设备设置的电子围栏的列表 fance
 * 每个设备最新的GPS位置  gps
 * Created by macmini on 16/8/30.
 */
@DatabaseTable(tableName = "watch_user")//表明这是数据库中的一张表
public class LoginUserInfoBean extends BaseBean{

    @DatabaseField(generatedId = true)//表明id为主键并且自动生成 该值服务器返回数据中并没有
    private int id;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @DatabaseField(canBeNull = true,foreign = true,columnName = "DsOut")
    private DsOut ds;

    @ForeignCollectionField(eager = false)//首先 注解是用于注解集合类的 支持的集合为ForeignCollection和Collection两种，其余不支持
                                        // 其次 eager表示该集合在初始化这个对象的时候 是否将集合取出，默认值false表示在遍历的时候才会取出，size()方法也会引起遍历
    private Collection<Userinfo> userinfo ;

    @ForeignCollectionField(eager = false)
    private Collection<Fence> fence ;

    @ForeignCollectionField(eager = false)
    private Collection<Gps> gps ;

    public void setDs(DsOut ds){
        this.ds = ds;
    }
    public DsOut getDs(){
        return this.ds;
    }
    public void setUserinfo(Collection<Userinfo> userinfo){
        this.userinfo = userinfo;
    }
    public Collection<Userinfo> getUserinfo(){
        return this.userinfo;
    }
    public void setFence(Collection<Fence> fence){
        this.fence = fence;
    }
    public Collection<Fence> getFence(){
        return this.fence;
    }
    public void setGps(Collection<Gps> gps){
        this.gps = gps;
    }
    public Collection<Gps> getGps(){
        return this.gps;
    }

    @Override
    public String toString() {
        return "LoginUserInfoBean{" +
                "ds=" + ds +
                ", userinfo=" + userinfo +
                ", fence=" + fence +
                ", gps=" + gps +
                '}';
    }
}